import { fromJS } from 'immutable';
import * as constants from './constants';

const defaultState = fromJS({
	cart: [],
	payResult: {},
	payType: false
});

export default (state = defaultState, action) => {
	switch(action.type) {
		case constants.CHANGE_CART:
			return state.set('cart', action.value);
		case constants.CHANGE_PAY:
			return state.set('payResult', action.value);
		case constants.CHANGE_PAY_TYPE:
			return state.set('payType', action.value);
		default:
			return state;
	}
}